package com.sunwayworld.basemodule.common.eptstorage.acqconfig.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.sunwayworld.framework.at.annotation.AuditTrailType;
import com.sunwayworld.framework.at.annotation.AuditTrailEntry;
import com.sunwayworld.framework.spring.annotation.GikamBean;

import com.sunwayworld.basemodule.common.eptstorage.acqconfig.dao.LimsAcqConfigManufacturerDao;
import com.sunwayworld.basemodule.common.eptstorage.acqconfig.bean.LimsAcqConfigManufacturerBean;
import com.sunwayworld.basemodule.common.eptstorage.acqconfig.service.LimsAcqConfigManufacturerService;
import com.sunwayworld.framework.context.ApplicationContextHelper;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

@Repository
@GikamBean
public class LimsAcqConfigManufacturerServiceImpl implements LimsAcqConfigManufacturerService {

    @Autowired
    private LimsAcqConfigManufacturerDao limsAcqConfigManufacturerDao;

    @Override
    @SuppressWarnings("unchecked")
    public LimsAcqConfigManufacturerDao getDao() {
        return limsAcqConfigManufacturerDao;
    }

    @Override
    @Transactional
    @AuditTrailEntry(AuditTrailType.INSERT)
    public Long insert(RestJsonWrapperBean jsonWrapper) {
        LimsAcqConfigManufacturerBean limsAcqConfigManufacturer = jsonWrapper.parseUnique(LimsAcqConfigManufacturerBean.class);
        limsAcqConfigManufacturer.setId(ApplicationContextHelper.getNextIdentity());
        getDao().insert(limsAcqConfigManufacturer);
        return limsAcqConfigManufacturer.getId();
    }

}
